home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MS_ARCAD.ZIP / ARC2_2.CHP < prev    next >
Text File  |  1993-06-15  |  11KB  |  307 lines

  1. %
  2. #EF
  3. #T15,1,Chapter 2     Computer Video Systems     Pg. 7
  4. #HS,1,4,80,25,11,1
  5. #C4,R5
  6. ~Y~I
  7.                           ~W~IIBM PC Palettes and Modes~Y~I
  8.  
  9. For PC video systems, a palette is a group of colors that can be displayed
  10. on the screen. Each adaptor has its own set of modes that it will support.
  11. Every mode has a different palette or set of palettes available. Figure 2.1,
  12. which appears on the next screen, shows the modes that are available on all
  13. of the most common PC video adaptors, the resolution of each mode, the
  14. number of colors each mode can display, and which adaptors support the
  15. particular mode.
  16.  
  17. #WN
  18. %
  19. #EF
  20. #T15,1,Chapter 2     Computer Video Systems     Pg. 8
  21. #HS,1,4,80,25,11,1
  22. #C4,R4
  23. ~Y~I
  24.                           ~W~IFigure 2.1~Y~I
  25.                        PC graphics modes
  26.  
  27.      ~R~IMode Number    Colors       Resolution        Adaptor
  28. ~Y~I          4,5         4           320 x 200      CGA, EGA, VGA, SVGA
  29.           6           2           640 x 200      CGA, EGA, VGA, SVGA
  30.           13          16          320 x 200      EGA, VGA, SVGA
  31.           14          16          640 x 200      EGA, VGA, SVGA
  32.           15          2           640 x 350      EGA, VGA, SVGA
  33.           16          16          640 x 350      EGA, VGA, SVGA
  34.           17          2           640 x 480      VGA, SVGA
  35.           18          16          640 x 480      VGA, SVGA
  36.           19          256         320 x 200      VGA, SVGA
  37.  
  38.  
  39.  
  40. #WN
  41. #EL,9
  42. #C4,R9
  43.           4,5         4           320 x 200      CGA, ~W~I~FEGA, VGA, SVGA~Y~I~N
  44. #EL,10
  45. #C4,R10
  46.           6           2           640 x 200      CGA, ~W~I~FEGA, VGA, SVGA~Y~I~N
  47.  
  48. #BO,4,18,78,22,7,1,0,3,15,5
  49. Notice that the CGA modes are supported by all of the higher resolution
  50. adaptors. The EGA modes are supported by the VGA. VGA modes are only
  51. supported by VGA and SuperVGA.
  52.  
  53. #EL,9
  54. #C4,R9
  55.           4,5         4           320 x 200      CGA, EGA, VGA, SVGA
  56. #EL,10
  57. #C4,R10
  58.           6           2           640 x 200      CGA, EGA, VGA, SVGA
  59.  
  60. #BO,4,19,78,22,7,1,0,2,15,5
  61. There are additional non-standard modes available on the SVGA that are
  62. not shown in this Figure.
  63.  
  64. #WP
  65. %
  66. #EF
  67. #T15,1,Chapter 2     Computer Video Systems     Pg. 9
  68. #HS,1,4,80,25,11,1
  69. #C4,R8
  70. ~Y~I
  71. In four color mode, the CGA adaptor has three built-in color palettes. This
  72. is shown in Figure 2.2 on the next screen.
  73.  
  74.  
  75. #WP
  76. %
  77. #EF
  78. #T15,1,Chapter 2     Computer Video Systems     Pg. 10
  79. #HS,1,4,80,25,11,1
  80. #C4,R5
  81.                          ~W~IFigure 2.2~Y~I
  82.                         CGA Palettes
  83.  
  84. ~R~IMode 4, Palette 0      Color number                  Color~Y~I
  85.                             0                   Background Color
  86.                             1                        Green
  87.                             2                         Red
  88.                             3                     Yellow/Brown
  89.  
  90. ~R~IMode 4, Palette 1      Color number                  Color~Y~I
  91.                             0                   Background Color
  92.                             1                        Cyan
  93.                             2                       Magenta
  94.                             3                        White
  95.  
  96. ~R~IMode 5                 Color number                  Color~Y~I
  97.                             0                   Background Color
  98.                             1                        Cyan
  99.                             2                         Red
  100.                             3                        White
  101.  
  102. #WN
  103. #BO,2,7,23,23,7,1,0,15,15,5
  104. As shown in
  105. Figure 2.2, there
  106. are four colors
  107. on each palette.
  108. If a pixel's two
  109. bits are set to 00,
  110. the background
  111. color is chosen.
  112. The background
  113. color may be any
  114. of the 16 colors
  115. available on the
  116. CGA. A list of the
  117. colors is shown in
  118. Figure 2.3.
  119.  
  120. #BO,55,4,77,24,7,1,0,19,15,5
  121. The other three
  122. colors are
  123. determined by which
  124. pallet is chosen.
  125. Each palette has its
  126. own predetermined
  127. set of three colors
  128. (not counting the
  129. background color)
  130. that are available,
  131. Under the BGI, the
  132. palette can be
  133. changed using the
  134. function
  135. setpalette(). As you
  136. can see from
  137. Figure 2.2, there
  138. are three palettes
  139. available.
  140.  
  141. #WP
  142. %
  143. #EF
  144. #T15,1,Chapter 2     Computer Video Systems     Pg. 11
  145. #HS,1,4,80,25,11,1
  146. #C4,R5
  147.                                ~W~IFigure 2.3~Y~I
  148.                        Colors available on the CGA
  149.  
  150. ~R~I          Numeric Value                                 Color~Y~I
  151.                 0                                       Black
  152.                 1                                       Blue
  153.                 2                                       Green
  154.                 3                                       Cyan
  155.                 4                                       Red
  156.                 5                                       Magenta
  157.                 6                                       Brown
  158.                 7                                       Light Grey
  159.                 8                                       Dark Grey
  160.                 9                                       Light Blue
  161.                 10                                      Light Green
  162.                 11                                      Light Cyan
  163.                 12                                      Light Red
  164.                 13                                      Light Magenta
  165.                 14                                      Yellow
  166.                 15                                      White
  167.  
  168. #WN
  169. #BO,2,10,23,20,7,1,0,9,15,5
  170. As stated on the
  171. last page, any of
  172. these can be used
  173. as the background
  174. color. The other
  175. three colors are
  176. determined by which
  177. palette is
  178. currently selected.
  179.  
  180.  
  181. #WP
  182. %
  183. #EF
  184. #T15,1,Chapter 2     Computer Video Systems     Pg. 12
  185. #HS,1,4,80,25,11,1
  186. #C4,R5
  187. ~Y~I
  188.  
  189. The EGA and VGA adaptors are much less limited in the number of colors they
  190. can use. EGA adaptors can display up to 16 colors at once, while standard
  191. VGA compatible adaptors will handle up to 256 colors at a time. Both EGA and
  192. VGA use palettes, but in a much different way that on the CGA.
  193.  
  194. #WN
  195. An EGA palette is actually a collection of 16 palette registers. Each
  196. |register| may contain a value that specifies any one of 64 possible colors.
  197. EGA pixels in video RAM ~R~Idon't hold color values ~Y~Ias they do on the CGA, they
  198. contain a register number. The register specifies the color value.
  199.  
  200. #WN
  201. #BO,4,17,78,21,7,1,0,3,15,5
  202. This scheme enables the EGA adaptor to display 64 colors, rather than
  203. just 4 as the CGA does. At the time that EGA adaptors were popular, 64
  204. colors seemed like a lot.
  205.  
  206. #C4,R17
  207. When the adaptor displays the colors for each pixel, it first reads the
  208. register number from the bit planes in video RAM, then goes to the register
  209. and gets the color value. Figure 2.4, on the next page, illustrates the
  210. process of turning an EGA pixel value into a color value.
  211.  
  212. #WP
  213. %
  214. #EF
  215. #T15,1,Chapter 2     Computer Video Systems     Pg. 13
  216. #HS,1,4,80,25,11,1
  217. #C1,R3
  218. ~Y~I
  219.                                    ~W~IFigure 2.4~Y~I
  220.                     Converting An EGA Pixel Value To A Color
  221.  
  222.                ~W~IPixel Value                     Palette Registers~Y~I
  223.                  ┌─────┐                      ~W~IContain Color Values~Y~I
  224.     Bit Plane 0  │  0  │                           ┌────────┐
  225.                  │     │                         0 │ 010010 │ 0000
  226.     Bit Plane 1  │  0  │    Selects Palette        ├────────┤
  227.                  │     │ ─────────┐ Register     1 │ 110101 │ 0001
  228.     Bit Plane 2  │  1  │          │                ├────────┤
  229.                  │     │          │              2 │ 000000 │ 0010
  230.     Bit Plane 3  │  1  │          │                ├────────┤
  231.                  └─────┘          └────────────» 3 │ 001001 │ 0011
  232.                                                    ├────────┤
  233.                                                  4 │ 000010 │ 0100
  234.                                                    ├────────┤
  235.                                                  5 │ 111111 │ 0101
  236.                                                  . ├────────┤
  237.                                                  . │        │
  238.                                                  . │        │
  239. #WN
  240. #BO,4,18,78,23,7,1,0,4,15,5
  241. As you can see, a pixel value in memory actually contains a register
  242. number. The register number that the pixel value selects contains a
  243. color number. The color number in the palette register is used to
  244. paint a dot onto the screen.
  245.  
  246. #EF
  247. #QT,T,arc2_2_1
  248. #WP
  249. %
  250. #EF
  251. #T15,1,Chapter 2     Computer Video Systems     Pg. 14
  252. #HS,1,4,80,25,11,1
  253. #C4,R5
  254. ~Y~I
  255. Life in the VGA world is even more complex. A VGA adaptor uses ~R~I16 palette
  256. registers,~Y~I just like the EGA. However, the VGA also uses a set of ~C~I256 DAC
  257. ~Y~I(Digital to Analog Converter) ~C~Icolor registers. ~Y~IThe information in the pixel
  258. in the bit planes in video RAM specifies a palette register. The pallet
  259. register in turn selects a DAC color register, which specifies a color. This
  260. "layered" approach gives the VGA the ability to display hundreds of colors.
  261.  
  262. ~SFigure 2.5, on the next page, illustrates the process of turning a VGA
  263. pixel value into a color value.~s
  264.  
  265. #WP
  266. %
  267. #EF
  268. #T15,1,Chapter 2     Computer Video Systems     Pg. 15
  269. #HS,1,4,80,25,11,1
  270. #C1,R3
  271. ~Y~I
  272.                                    ~W~IFigure 2.5~Y~I
  273.                     Converting A VGA Pixel Value To A Color
  274.  
  275.                ~W~IPixel Value                 Palette Registers Contain~Y~I
  276.                  ┌─────┐                     ~W~IDAC Register Numbers~Y~I
  277.     Bit Plane 0  │  0  │                           ┌────────┐
  278.                  │     │                         0 │ 010010 │
  279.     Bit Plane 1  │  0  │    Selects Palette        ├────────┤
  280.                  │     │ ─────────┐ Register     1 │ 110101 │
  281.     Bit Plane 2  │  1  │          │                ├────────┤
  282.                  │     │          │              2 │ 000000 │
  283.     Bit Plane 3  │  1  │          │                ├────────┤
  284.                  └─────┘          └────────────» 3 │ 000010 │ ───┐
  285.                                                  . ├────────┤    │
  286.                          ~W~IDAC Registers Hold~Y~I      . │        │    │
  287.                             ~W~IColor Values~Y~I         . │        │    │
  288.                                 ┌────────────────────────────────┘
  289.        0          1          2  V
  290.  ┌──────────┬──────────┬──────────┬────────
  291.  │ 01011101 │ 00010001 │ 11010010 │
  292.  └──────────┴──────────┴──────────┴────────
  293.  
  294. #WN
  295. #BO,4,18,78,21,7,1,0,2,15,5
  296. Like the EGA, a pixel value in memory actually contains a palette
  297. register number.
  298.  
  299. #BO,4,10,78,13,7,1,0,2,15,5
  300. The palette register contains a video DAC register number. The DAC
  301. register contains the color number.
  302.  
  303. #EF
  304. #QT,T,arc2_2_2
  305. #WP
  306. #X
  307.